import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/index"
  },
  {
    path: '/index',
    name: 'index',
    component: () => import(/* webpackChunkName: "index" */ '../views/index.vue'),
    children:[
      {
        path:"/index",
        redirect: "/index/home"
      },
      {
        path: '/index/home',
        name: 'home',
        component: () => import(/* webpackChunkName: "home" */ '../views/home/index.vue'),
      },
      {
        path: '/index/list',
        name: 'list',
        component: () => import(/* webpackChunkName: "list" */ '../views/list/index.vue'),
      },
      {
        path: '/index/shop',
        name: 'shop',
        component: () => import(/* webpackChunkName: "shop" */ '../views/shop/index.vue'),
      },
      {
        path: '/index/my',
        name: 'my',
        component: () => import(/* webpackChunkName: "my" */ '../views/my/index.vue'),
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
